<template>
  <Container class="mrebate-check-info">
    <!-- 基础设置 -->
    <div class="container-header title title-center" slot="header">
      进货明细
      <Button
        size="large"
        class="fl btn-back"
        icon="ios-arrow-back"
        @click="jumpPrevPage"
      >返回</Button>
        <export-btn :url="'/assets/store_int_month/item/export/' + id" class="fr"></export-btn>
    </div>
    <div class="mt">
      <Table 
          :height="options.tableHeight" 
          stripe
          :columns="list.columns" 
          :data="list.data"
          no-data-text="亲，没有找到相关记录哦！~"></Table>
      </div>
      <div slot="footer" class="container-footer bg-white bold">
        {{subtotal}}
      </div>
      <Loader :status="list.status" @refresh="getDetail"></Loader>
  </Container>
</template>
<script>
  import table from '@/table'
  import IntegralMonthInfoData from './list/IntegralMonthInfoData'
  export default {
    name: "MrabateCheckInfo",
    data() {
      return {
        list: IntegralMonthInfoData,
        id: this.$route.query.id,
        options: {
          tableHeight: 300
        },
        subtotal: ''
      }
    },
    mounted() {
      this.initTable()
      this.getDetail()
    },
    methods: {
      ...table,
      jumpPrevPage() {
        this.$router.back()
      },
      getDetail() {
        this.list.status = 'loading'
        this.$ajaxGet(`/assets/store_int_month/item/${this.id}`).then(data => {
          this.list.status = 'pass'
          this.list.data = []
          this.list.data = data.response.records || []
          this.subtotal = data.sumDTO.subtotal
        }).catch(() => {
          this.list.status = 'error'
        })
      }
    }
  };
</script>
